package com.modelscope.ai.controller;

import com.modelscope.ai.domain.entity.R;
import com.modelscope.ai.service.impl.OssServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;



@RestController
@RequestMapping("/oss")
public class OssController {

    @Autowired
    OssServiceImpl ossService;

    @PostMapping("/upload")
    public R<String> uploadOssFile(@RequestParam("file") MultipartFile file) {
        //上传文件，返回文件url
        String url = ossService.uploadFileAvatar(file);
        return R.ok(url);
    }
}